package com.doublefish.doublefishrobot.utils.db.database.bean;

/**
 * 作者:dugaofeng on 2024/10/16 14:40
 */
public class SqlInfoModel {

    /**
     *      sql语句的模型信息
     *
     * */

    private String mTableName;  //表名
    private int mVersion = 1;   //默认版本1
    private String mSqlString;  //sql语句的内容
    private SqlOperateType mOperateType = SqlOperateType.ADD_TABLE;   //默认为创建表

    private String mOldTableName;  //如果用sql语句修改了表名,需要setOldTableName

    private SqlInfoModel() {

    }

    public SqlInfoModel(String tableName,String sqlString) {
        this.mTableName = tableName;
        this.mSqlString = sqlString;
    }

    public SqlInfoModel(String tableName,String sqlString,int version,SqlOperateType operateType) {
        this.mTableName = tableName;
        this.mSqlString = sqlString;
        this.mVersion = version;
        this.mOperateType = operateType;
    }

    public int getVersion() {
        return mVersion;
    }
    public void setVersion(int mVersion) {
        this.mVersion = mVersion;
    }

    public void setTableName(String mTableName) {
        this.mTableName = mTableName;
    }

    public String getTableName() {
        return mTableName;
    }

    public String getSqlString() {
        return mSqlString;
    }
    public void setSqlString(String sqlString) {
        this.mSqlString = sqlString;
    }

    public void setOperateType(SqlOperateType mOperateType) {
        this.mOperateType = mOperateType;
    }

    public SqlOperateType getOperateType() {
        return mOperateType;
    }

    //fixme 如果用sql语句修改了表名,需要setOldTableName
    public void setOldTableName(String mOldTableName) {
        this.mOldTableName = mOldTableName;
    }

    public String getOldTableName() {
        return mOldTableName;
    }


    //sql语句对表结构的操作
    public enum SqlOperateType {
        ADD_TABLE,             //新增表
        DELETE_TABLE,          //删除表结构
        UPDATE_TABLE,          //修改表字段  索引等
        ALTER_TABLENAME        //修改表名
    }

}